package J5_6;

import java.util.Scanner;

public class test {
    public static void main1(String[] args) {
        Scanner in = new Scanner(System.in);
        int a1 = in.nextInt(), h1 = in.nextInt(), a2 = in.nextInt(), h2 = in.nextInt();
        long res = 0;
        while (h1 > 0 && h2 > 0) {
            res += a1;
            res += a2;
            h1 -= a2;
            h2 -= a1;
            if (h1 <= 0 && h2 > 0) {
                res += a2 * 10L;
            } else if (h2 <= 0 && h1 > 0) {
                res += a1 * 10L;
            }
        }
        System.out.println(res);
    }
    public static void main2(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = in.nextInt();
        }
        long[] dp = new long[n];
        dp[0] = arr[0];
        long res = dp[0];
        for (int i = 1; i < n; i++) {
            dp[i] = Math.max(dp[i-1] + arr[i], arr[i]);
            res = Math.max(res, dp[i]);
        }
        System.out.println(res);


    }

    public static void main3(String[] args) {
        Scanner in = new Scanner(System.in);
        String str = in.next();
        int len = str.length();
        boolean[][] dp = new boolean[len][len];
        int res = 0;
        for (int i = len - 1; i >= 0; i--) {
            for (int j = i; j < len; j++) {
                if (str.charAt(i) == str.charAt(j)) {
                    dp[i][j] = i >= j - 1 || dp[i + 1][j - 1];
                }
                if (!dp[i][j])
                    res = Math.max(res , j - i + 1);
            }
        }
        System.out.println(res);

    }

    //给你一个字符串 s ，请你统计并返回这个字符串中 回文子串 的数目。
    //
    //回文字符串 是正着读和倒过来读一样的字符串。
    //
    //子字符串 是字符串中的由连续字符组成的一个序列。
    //
    //具有不同开始位置或结束位置的子串，即使是由相同的字符组成，也会被视作不同的子串。
    public int countSubstrings(String s) {
        int n = s.length();
        boolean[][] dp = new boolean[n][n];
        int res = 0;
        for (int i = n - 1; i >= 0; i--) {
            for (int j = i; j < n; j++) {
                if (s.charAt(i) == s.charAt(j)) {
                    dp[i][j] = i >= j - 1 || dp[i + 1][j - 1];
                }
                if (dp[i][j]) {
                    res++;
                }
            }
        }
        return res;
    }



    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String str = in.next();
        int len = str.length();


    }
}
